package com.itheima05;

/**
 * @author Xiao
 * @date 2021/7/17
 */
public class InnerClassDemo04 {
    public static void main(String[] args) {
        method(new Swimming() {
            @Override
            public void swimming() {
                System.out.println("狗会狗刨游泳");
            }
        });
        //理解Lambda表达式：() -> {} → 对匿名内部类进行了优化
        method(() -> {
            System.out.println("青蛙会蛙泳");
        });
    }

    public static void method(Swimming s) {
        s.swimming();
    }
}

interface Swimming {
    void swimming();
}